import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/foundation.dart';

class DDAudioPlayerService {

  static final DDAudioPlayerService _instance = DDAudioPlayerService._internal();

  final AudioPlayer audioPlayer = AudioPlayer();

  DDAudioPlayerService._internal() {
    debugPrint('DDAudioPlayerService:');
  }
  factory DDAudioPlayerService() {
    debugPrint('factory:');
    return _instance;
  }

  Future<void> play(String url) async {
    await audioPlayer.play(UrlSource(url));
  }

  Future<void> pause() async {
    await audioPlayer.pause();
  }

  Future<void> stop() async {
    await audioPlayer.stop();
  }

}